package com.gnetek.netty.application;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

/**
 * @Description 描述
 * @Author Darren Huang
 * @Date 2022-11-22 15:23
 */
public class NettyApp extends Application {
    @Override
    public void start(Stage stage) throws Exception {
        Parent nettyClientFxml = FXMLLoader.load(getClass().getResource("/fxml/NettyClient.fxml"));//加载第一个页面

        stage.setTitle("模拟Socket客户端");
        Scene scene = new Scene(nettyClientFxml);

        stage.getIcons().add(new Image("/img/bee.png"));
        stage.setScene(scene);//设置场景
        stage.setResizable(false);//不能改变窗口大小
        stage.show();//显示
        stage.setOnCloseRequest(event->{
//            EchoClient.close();
            Platform.runLater(()->System.exit(0));
        });

        stage.show();
    }
}
